//
//  EMChatNotiCell.m
//  Molian
//
//  Created by wansong on 4/24/15.
//  Copyright (c) 2015 xiaocan. All rights reserved.
//

#import "EMChatNotiCell.h"

@implementation EMChatNotiCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    self.backgroundColor = [UIColor clearColor];
    [self.textLabel.layer setCornerRadius:3.0f];
    self.textLabel.layer.masksToBounds = YES;
    self.textLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.2];
    self.textLabel.textAlignment = NSTextAlignmentCenter;
    self.textLabel.font = [UIFont fontWithName:FontName size:13];
    self.textLabel.textColor = [UIColor whiteColor];
//    self.textLabel.lineBreakMode = NSLineBreakByWordWrapping;
    self.textLabel.numberOfLines = 0;
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    
    NSDictionary *attributes = @{NSFontAttributeName: [UIFont fontWithName:FontName size:14]};
    CGRect textRect = [self.textLabel.text boundingRectWithSize:CGSizeMake(DeviceWidth-160, MAXFLOAT)
                                                    options:NSStringDrawingUsesLineFragmentOrigin
                                                 attributes:attributes
                                                    context:nil];
    self.textLabel.frame = CGRectMake((DeviceWidth-textRect.size.width)/2, 5, textRect.size.width, textRect.size.height);
                
}

@end
